APPNAME=glboiler
SOURCE=../../Source/
BUILD=../../Build/glboiler/Mac
LIBS=-framework SDL -framework SDL_image -framework OpenGL -framework GLUT -lm -lstdc++
CC=gcc
CFLAGS=-DMACOSX -I$(SOURCE) -I/Library/Frameworks/SDL_image.framework/Headers/ -I/Library/Frameworks/SDL.framework/Headers/

SOURCES	:= $(SOURCE)

CPPFILES        :=      $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))


OFILES   :=      $(addsuffix .o,$(BINFILES)) \
                                        $(addsuffix .o,$(TPLFILES)) \
                                        $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \
                                        $(MFILES:.m=.o) \
                                        $(sFILES:.s=.o) $(SFILES:.S=.o)

OBJ = $(patsubst %,$(BUILD)/%,$(OFILES))

$(BUILD)/%.o: $(SOURCE)/%.cpp 
	mkdir -p $(BUILD); 
	$(CC) -c -o $@ $< $(CFLAGS)

$(BUILD)/$(APPNAME): $(OBJ)
	gcc -o $@ $^ $(CFLAGS) $(LIBS)


.PHONY: clean

clean:
	rm -f $(BUILD)/*.o $(BUILD)/$(APPNAME)

run:
	cp -R ../../Assets/* $(BUILD)/; \
	cd $(BUILD); \
	./$(APPNAME)

